"""
    relu 函数
"""

import numpy as np
import matplotlib.pyplot as plt

def relu(x):
    """
    relu 函数 ：
        x > 0  -> y = x
        x <= 0 -> y = 0
    :param x:
    :return:
    """
    return np.maximum(0,x)


if __name__ == '__main__':
    x = np.arange(-4,4,0.1)
    y= relu(x)

    plt.plot(x,y)
    plt.ylim(-1,5)
    plt.xlim(-5,5)
    plt.show()